package com.study.a01mystream;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class StreamDemo2 {
    public static void main(String[] args) {

        //单链集合获取一条stream流
        ArrayList<String> list1=new ArrayList<>();
        Collections.addAll(list1,"张三","李四","王五","王六","王七","张无极");
      /*  //获取一条流水线，将集合中数据压到流水线上
        Stream<String> stream1 = list1.stream();
        //用终结方法打印流水线上的所有数据
        stream1.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });*/


        list1.stream().forEach(s-> System.out.println(s));

    }
}
